<?php
	require_once('config/config.php');
	
	
	list($dummy, $urirw) = explode(dirname($_SERVER["SCRIPT_NAME"]) . '/', $_SERVER['REQUEST_URI'], 2);
	define('REQUESTURI', $_SERVER['REQUEST_URI']);

	$tabrw = explode('/', $urirw);
	$der = $tabrw[count($tabrw) - 1];
	
	if (!strstr($der, '.html'))
	{
		$urirw .= '.html';
		$tabrw = explode('/', $urirw);
	}

	$lngrw = $tabrw[1];
	$page = $tabrw[2];
	$page = str_replace('.html', '', $page);
	$GLOBALS["page"] = $page;
	
	$nb = count($tabrw);
	
	if ($nb > 3)
	{
		$i = 3;
		while ($i < $nb)
		{
			$cle = trim($tabrw[$i]);
			$val = trim($tabrw[$i + 1]);
			$val = str_replace('.html', '', $val);
			$GLOBALS[$cle] = $val;
			$i += 2;
		}
	}
	if (!is_s("bo_user") && $page <> 'oublie' && $page <> 'friend')
		$page = 'login';
	
	if (!is_file(DIR_SCRIPTS . $page . '.' . EXTENSION) || !is_file(DIR_HTML . $page . '.' . EXTENSION_TPL))
		$page = PAGE404;
	if (MAINTENANCE)
	{
		$page = 'travaux';
		$urirw = DIR_HTML_STATIQUE . '/' . APPLNG . '/' . PAGEMAINTENANCE . '.html';
	}
	
	if ($page == PAGE404)
		$urirw = DIR_HTML_STATIQUE . '/' . APPLNG . '/' . PAGE404 . '.html';
	if ($page == PAGEDEFAUT && BO_USER_ROLE == 3)
		$page = 'gorillaz';
	
	define('PAGE', $page);
	GP_dispatch :: getInstance();
?>